package cn.itcast.bos.service.base.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;

import cn.itcast.bos.dao.base.StandardRepository;
import cn.itcast.bos.domain.base.Standard;
import cn.itcast.bos.service.base.StandardService;
@Service("standardService")
public class StandardServiceImpl implements StandardService {
	@Autowired
	private StandardRepository standardRepository;
	@CacheEvict(value = "standard",allEntries = true)
	@Override
	public void save(Standard standard) {
		standardRepository.save(standard);
	}
	@Cacheable(value = "standard",key = "#pageable.pageNumber+'_'+#pageable.pageSize")
	@Override
	public Page<Standard> findPageData(Pageable pageable) {
		return standardRepository.findAll(pageable);
	}
	//查询所有的收派标准
	@Cacheable("standard")
	@Override
	public List<Standard> fandAll() {
		return standardRepository.findAll();
	}

}
